#include<stdio.h>



int main(){

	char str[] = "aabcccaaa";
	char* s = str;

	char state='\0', th;

	int count;



	while(s[0] != '\0'){

		if(state != s[0]){

			printf("%c%d", state, count);

			state = s[0];

			count = 1;

		}else{

			count++;

		}

		s++;

	}
			printf("%c%d\n", state, count);



	return 0;

}